<extend name="Base/common"/>


<block name="body">

    <section>
        <div class="login-text"><strong><h1>欢迎注册One Plus</h1></strong></div>
        <div class="login-form-upbox">
        <form class="login-form" action="__SELF__" method="post">
                <div class="control-group login-input">


                    <div class="controls">
                        <input type="text" id="inputEmail" class="form-control" placeholder="请输入用户名"
                               ajaxurl="/member/checkUserNameUnique.html" errormsg="请填写1-16位用户名" nullmsg="请填写用户名"
                               datatype="*1-16" value="" name="username">
                    </div>
                </div>
                <div class="control-group login-input">


                    <div class="controls">
                        <input type="password" id="inputPassword" class="form-control" placeholder="请输入密码"
                               errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">
                    </div>
                </div>
                <div class="control-group login-input">


                    <div class="controls">
                        <input type="password" id="inputPassword" class="form-control" placeholder="请再次输入密码"
                               recheck="password" errormsg="您两次输入的密码不一致" nullmsg="请填确认密码" datatype="*"
                               name="repassword">
                    </div>
                </div>
                <div class="control-group login-input">


                    <div class="controls">
                        <input type="text" id="inputEmail" class="form-control" placeholder="请输入电子邮件"
                               ajaxurl="/member/checkUserEmailUnique.html" errormsg="请填写正确格式的邮箱" nullmsg="请填写邮箱"
                               datatype="e" value="" name="email">
                    </div>
                </div>


                <div class="control-group">
                    <div class="controls">
                        <button type="submit" class="btn btn-primary">注 册</button>
                    </div>
                </div>
            </form>
</div>
    </section>

</block>

<block name="side"></block>
<block name="script">
    <script type="text/javascript">
        $(document)
                .ajaxStart(function () {
                    $("button:submit").addClass("log-in").attr("disabled", true);
                })
                .ajaxStop(function () {
                    $("button:submit").removeClass("log-in").attr("disabled", false);
                });


        $("form").submit(function () {
            var self = $(this);
            $.post(self.attr("action"), self.serialize(), success, "json");
            return false;

            function success(data) {
                if (data.status) {
                    op_success('注册成功，正在登录。', '温馨提示');
                    setTimeout(function () {
                        window.location.href = data.url
                    }, 1500);
                } else {
                    op_error(data.info,'温馨提示');
                    /*self.find(".Validform_checktip").text(data.info);
                    //刷新验证码
                    $(".reloadverify").click();*/
                }
            }
        });

        $(function () {
            var verifyimg = $(".verifyimg").attr("src");
            $(".reloadverify").click(function () {
                if (verifyimg.indexOf('?') > 0) {
                    $(".verifyimg").attr("src", verifyimg + '&random=' + Math.random());
                } else {
                    $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
                }
            });
        });
    </script>
</block>
